package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteJobService;
import com.ruoyi.system.api.domain.SysJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteJobFallbackFactory implements FallbackFactory<RemoteJobService> {
    private static final Logger log= LoggerFactory.getLogger(RemoteJobFallbackFactory.class);

    @Override
    public RemoteJobService create(Throwable cause) {
        return new RemoteJobService() {
            @Override
            public Long addTask(SysJob sysJob, String source) {
                return sysJob.getJobId();
            }

            @Override
            public AjaxResult runStartAt(SysJob job, String source) {
                return null;
            }
        };
    }
}
